-- 弱肉强食
local ruorouqiangshi = fk.CreateSkill{
    name = "mcdh_ruorouqiangshi",
    frequency = Skill.Compulsory,
}

ruorouqiangshi:addEffect(fk.DamageCaused,{
    can_trigger = function(self, event, target, player, data)
        if target ~= player or not player:hasSkill(self) then
            return false
        end
        if player:usedSkillTimes(self.name, Player.HistoryRound) > 0 then
            return false
        end
        return player.hp > data.to.hp and #player:getCardIds(Player.Hand) > #data.to:getCardIds(Player.Hand)
    end,
    on_use = function(self, event, target, player, data)
        data.damage = data.damage + 1
        player.room:setPlayerMark(player, "@mcdh__RuoRouQiangShi_1", 0)
    end,
})

ruorouqiangshi:addEffect(fk.DamageInflicted,{
    can_trigger = function(self, event, target, player, data)
        if target ~= player or not player:hasSkill(mcdh__RuoRouQiangShi) then
            return false
        end
        if player:usedSkillTimes(self.name, Player.HistoryRound) > 0 then
            return false
        end
        return data.from and player.hp > data.from.hp and #player:getCardIds(Player.Hand) > #data.from:getCardIds(Player.Hand)
    end,
    on_use = function(self, event, target, player, data)
        data.damage = data.damage - 1
        player.room:setPlayerMark(player, "@mcdh__RuoRouQiangShi_2", 0)
    end,
})

ruorouqiangshi:addEffect(fk.RoundStart,{
    can_refresh = function(self, event, target, player, data)
        return player:hasSkill(self)
    end,
    on_refresh = function(self, event, target, player, data)
        player.room:setPlayerMark(player, "@mcdh__RuoRouQiangShi_1", 1)
        player.room:setPlayerMark(player, "@mcdh__RuoRouQiangShi_2", 1)
    end,
})

return ruorouqiangshi
